using Microsoft.AspNetCore.Mvc;
using OutpatientApi.DTO;
using OutpatientApi.Methodimplementation.IServices;
using Outpatient.ErrorCode;

namespace OutpatientApi.Controllers
{
    /// <summary>
    /// 医疗卡办理控制器
    /// </summary>
    [ApiController]
    [Route("api/[controller]/[action]")]
    public class MedicalCardRegistrationController : ControllerBase
    {
        private readonly IPatientRegistrationService _patientRegistrationService;

        /// <summary>
        /// 构造函数
        /// </summary>
        /// <param name="patientRegistrationService">病人挂号服务</param>
        public MedicalCardRegistrationController(IPatientRegistrationService patientRegistrationService)
        {
            _patientRegistrationService = patientRegistrationService;
        }

        /// <summary>
        /// 添加医疗卡办理
        /// </summary>
        /// <param name="addDto">添加医疗卡办理参数</param>
        /// <returns>添加结果</returns>
        [HttpPost]
        public async Task<ApiResult<int>> AddMedicalCardRegistration([FromBody] AddMedicalCardRegistrationDto addDto)
        {
            return await _patientRegistrationService.AddMedicalCardRegistrationAsync(addDto);
        }

        /// <summary>
        /// 获取所有民族数据
        /// </summary>
        /// <returns>民族数据列表</returns>
        [HttpGet]
        public async Task<ApiResult<List<EthnicGroupDto>>> GetAllEthnicGroups()
        {
            return await _patientRegistrationService.GetAllEthnicGroupsAsync();
        }

        /// <summary>
        /// 获取所有文化程度数据
        /// </summary>
        /// <returns>文化程度数据列表</returns>
        [HttpGet]
        public async Task<ApiResult<List<CultureDto>>> GetAllCultures()
        {
            return await _patientRegistrationService.GetAllCulturesAsync();
        }

        /// <summary>
        /// 获取所有职业数据
        /// </summary>
        /// <returns>职业数据列表</returns>
        [HttpGet]
        public async Task<ApiResult<List<OccupationDto>>> GetAllOccupations()
        {
            return await _patientRegistrationService.GetAllOccupationsAsync();
        }
    }
} 